//
//  MessageTableCell.m
//  cocoapodText
//
//  Created by apple on 16/9/16.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ShiPei.h"
#import "MessageTableCell.h"
#import <Foundation/Foundation.h>


@interface MessageTableCell()
@property(nonatomic,strong) MessageTableCellView *tableCellView;
@end

@implementation MessageTableCell

//重写构造方法，让自定义的cell一创建出来就有四个子控件
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setFrame:[ShiPei CGRectMakeScale:0 :0 :TabChildContentW :35]];
        
        MessageTableCellView *tableCellView=[[MessageTableCellView alloc] initWithFrame:[ShiPei CGRectMakeScale:0 :0 :TabChildContentW :35]];
        [self addSubview:tableCellView];
        [tableCellView setBackgroundColor:[UIColor clearColor]];
        self.tableCellView=tableCellView;
        
    }
    return self;
}

/**
 *  重写set方法
 *
 *  @param car
 */
-(void)setMessageinfo:(messageInfo *)messageinfo{
    //不要忘了，记录传递进来的模型
    _messageinfo=messageinfo;
    //给子控件赋值数据
    [self settingData];
}
/**
 *  对子控件的数据进行设置
 */
-(void)settingData{
    if ([_messageinfo.color isEqualToString:@"0"]) {
        [self setBackgroundColor:FUIColorFromRGB(0xf0f4f7)];
    }else{
        [self setBackgroundColor:[UIColor whiteColor]];
    }
    [_tableCellView setName:_messageinfo.name];
    [_tableCellView setType:_messageinfo.type];
    [_tableCellView setTime:_messageinfo.time];
    [_tableCellView setContent:_messageinfo.content];
    [_tableCellView setNumber:_messageinfo.number];
    [_tableCellView setNumber2:_messageinfo.number2];
    [_tableCellView setStatus:_messageinfo.status];
}

@end

